import { Component, OnInit } from '@angular/core';
import { JsonApiService } from "app/core/api/json-api.service"; //http请求配置引入
import { config } from '../../shared/smartadmin.config';
import { Router, ActivatedRoute } from "@angular/router"; //路由引入
declare var $: any;
declare var echarts: any;
@Component({
	selector: 'sa-artificialMonitor',
	templateUrl: './artificialMonitor.component.html',
	styleUrls: ['./artificialMonitor.component.css']
})
export class ArtificialMonitorComponent implements OnInit {
	tableData: any[] = []; //table数据
	totalCount: number = 0; //分页总条数
	curPage: number = 1; //分页当前页
	pageSize: number = 10; //内置的分页每页条数
	searchKey: string = ''; //搜索keyword
	carList: any[] = [];
	companyId: string = '';
	deviceId: string = '';//设备ID
	startTime: string = '';
	endTime: string = '';
	carNumber: string = ''; //车牌号码
	selectedCompanyId: string = '';
	selectedCompanyName: string = '';
	exceptionType: string = '';//问题分类
	exceptionTypeName: string = '';
	programType: string = '';//现象分类
	programTypeName: string = '';
	useTypeL1: string = '';//useTypeL1  select值
	useTypeL1Name: string = '';
	useTypeL2: string = '';//useTypeL2  select值
	useTypeL2Name: string = '';
	carTypeDetailList: any = [];//useTypeL2数据
	carTypeList: any = [];
	carUseList: any = {};
	carDeatailUseList: any = {}
	activeSelected: string = '';
	selectedRow: any;
	startTime_chart: string = '';
	endTime_chart: string = '';
	isChartView = false;
	//画轨迹的数据
	drawTrackArr: any;
	isMapView = false;
	specifyId = {
		picker1: 'datetimepicker3',
		picker2: 'datetimepicker4'
	}
	specifyTime = {
		startTime: '',
		endTime: '',
	}
	problemBtnType: string = 'algorithm';//问题记录类型
	algorithmlList: any = {
		bulkCar: [],
		baggedCar: [],
		ohterCar: []
	};//算法问题数据
	hardwareList: any = {
		bulkCar: [],
		baggedCar: [],
		ohterCar: []
	};//硬件问题数据
	driverQuestionList: any = {
		bulkCar: [],
		baggedCar: [],
		ohterCar: []
	};//司机问题数据
	concatQuestionList: any = {
		bulkCar: [],
		baggedCar: [],
		ohterCar: []
	};//对接问题数据
	operatQuestionList: any = {
		bulkCar: [],
		baggedCar: [],
		ohterCar: []
	};//运维问题数据
	installQuestionList: any = {
		bulkCar: [],
		baggedCar: [],
		ohterCar: []
	}//安装问题数据
	questionDataSortList: any = [];
	dataAbnormalCarTotalList: any = [];
	dataAbnormalCarTotal: number = 0;//问题汇总总条数
	dataAbnormalCarList: any = [];//问题汇总饼状图数据


	dataAbnormalCarTopList: any = [];//排名数据
	curBtn: string = '';//排名高亮按钮,默认一周
	topNumber: string = '10';//默认top10
	checkQuanxian = true;	//审核权限
	isCheck = '';			// 审核状态：0：未审核，1：已审核
	checkrowMes: any;	// 列表行审核的数据
	checkRemark = '';			// 审核信息备注
	quickAudit = false;			// 是否显示快速审核按钮
	questionTypeList: any = [{
		id: '1',
		label: '算法问题',
		children: [{
			id: '101',
			label: '上货问题',
		}, {
			id: '104',
			label: '多次上货',
		}, {
			id: '102',
			label: '卸货问题',
		}, {
			id: '105',
			label: '多次卸货',
		}, {
			id: '103',
			label: '在途问题',
		}, {
			id: '100',
			label: '其他',
		}]
	}, {
		id: '2',
		label: '硬件问题',
		children: [{
			id: '201',
			label: '主机问题',
		}, {
			id: '202',
			label: '传感器问题',
		}, {
			id: '203',
			label: 'GPS问题',
		},
		{
			id: '204',
			label: '线材问题'
		},
		{
			id: '200',
			label: '其他',
		}]
	}, {
		id: '3',
		label: '司机问题',
		children: [{
			id: '301',
			label: '司机问题',
		}, {
			id: '300',
			label: '其他',
		}]
	}, {
		id: '4',
		label: '对接问题',
		children: [{
			id: '401',
			label: '对接问题',
		}, {
			id: '400',
			label: '其他',
		}]
	}, {
		id: '5',
		label: '运维问题',
		children: [{
			id: '501',
			label: '运维问题',
		}, {
			id: '500',
			label: '其他',
		},

		]
	},
	{
		id: '6',
		label: '安装问题',
		children: [
			{
				id: '601',
				label: '安装问题'
			},
			{
				id: '600',
				label: '其他'
			}
		]
	}
	];
	questionNameList: any = {
		'1': '算法问题',
		'2': '硬件问题',
		'3': '司机问题',
		'4': '对接问题',
		'5': '运维问题',
		'6': '安装问题'
	};
	questionDeatailNameList: any = {
		'100': '其他',
		'101': '上货问题',
		'102': '卸货问题',
		'103': '在途问题',
		'104': '多次上货',
		'105': '多次卸货',
		'200': '其他',
		'201': '主机问题',
		'202': '传感器问题',
		'203': 'GPS问题',
		'204': '线材问题',
		'300': '其他',
		'301': '司机问题',
		'400': '其他',
		'401': '对接问题',
		'500': '其他',
		'501': '运维问题',
		'601': '安装问题',
		'600': '其他'
	}
	questionTypeDetailList: any = [];
	inputCompanyTreeCarData: any = {};//车辆运行状态模块跳转该页面传递过来的参数
	InputTime: any = {
		startTime: '',
		endTime: ''
	};//父级传子组件的时间
	constructor(private jsonApiService: JsonApiService, private router: Router, private activatedRoute: ActivatedRoute) {
		activatedRoute.queryParams.subscribe(queryParams => {
			this.inputCompanyTreeCarData = JSON.parse(common.getCookie('jumpQuestionByHandList'));
		});
	}

	btnClick(type) {
		this.problemBtnType = type;
	}
	//问题记录
	getProblemsDatas(modal) {
		let data = {
			companyId: this.selectedCompanyId,
			carNumber: this.carNumber,
			deviceId: this.deviceId,
			startDate: this.startTime,
			endDate: this.endTime,
			searchKey: this.searchKey,
			useTypeL1: this.useTypeL1,
			useTypeL2: this.useTypeL2,
			exceptionType: this.exceptionType,
			programType: this.programType
		}
		let reqdata = 'param=' + JSON.stringify(data);
		this.jsonApiService.http("dataExceptionRecord/countDataRecord.html", reqdata).subscribe(result => {
			this.algorithmlList = {
				bulkCar: [],
				baggedCar: [],
				ohterCar: []
			};
			this.hardwareList = {
				bulkCar: [],
				baggedCar: [],
				ohterCar: []
			};
			this.driverQuestionList = {
				bulkCar: [],
				baggedCar: [],
				ohterCar: []
			};//司机问题数据
			this.concatQuestionList = {
				bulkCar: [],
				baggedCar: [],
				ohterCar: []
			};//对接问题数据
			this.operatQuestionList = {
				bulkCar: [],
				baggedCar: [],
				ohterCar: []
			};//运维问题数据
			this.installQuestionList = {
				bulkCar: [],
				baggedCar: [],
				ohterCar: []
			};//安装问题数据
			this.questionDataSortList = []
			for (let item of result.data) {
				if (item.exceptionType) {
					let type = item.useTypeL2;
					if (item.exceptionType == '1') {
						if (type == '0101') this.algorithmlList.bulkCar.push(item);		//散装
						if (type == '0102') this.algorithmlList.baggedCar.push(item);		//袋装
						if (!(type == '0101' || type == '0102')) this.algorithmlList.ohterCar.push(item);		//其他
					}
					if (item.exceptionType == '2') {
						if (type == '0101') this.hardwareList.bulkCar.push(item);		//散装
						if (type == '0102') this.hardwareList.baggedCar.push(item);		//袋装
						if (!(type == '0101' || type == '0102')) this.hardwareList.ohterCar.push(item);		//其他
					}
					if (item.exceptionType == '3') {
						if (type == '0101') this.driverQuestionList.bulkCar.push(item);		//散装
						if (type == '0102') this.driverQuestionList.baggedCar.push(item);		//袋装
						if (!(type == '0101' || type == '0102')) this.driverQuestionList.ohterCar.push(item);		//其他
					}
					if (item.exceptionType == '4') {
						if (type == '0101') this.concatQuestionList.bulkCar.push(item);		//散装
						if (type == '0102') this.concatQuestionList.baggedCar.push(item);		//袋装
						if (!(type == '0101' || type == '0102')) this.concatQuestionList.ohterCar.push(item);		//其他
					}
					if (item.exceptionType == '5') {
						if (type == '0101') this.operatQuestionList.bulkCar.push(item);		//散装
						if (type == '0102') this.operatQuestionList.baggedCar.push(item);		//袋装
						if (!(type == '0101' || type == '0102')) this.operatQuestionList.ohterCar.push(item);		//其他
					}
					if (item.exceptionType == '6') {
						if (type == '0101') this.installQuestionList.bulkCar.push(item);		//散装
						if (type == '0102') this.installQuestionList.baggedCar.push(item);		//袋装
						if (!(type == '0101' || type == '0102')) this.installQuestionList.ohterCar.push(item);		//其他
					}
				}
			}
			this.questionDataSortList.push({ title: '算法问题', data: this.algorithmlList });
			this.questionDataSortList.push({ title: '硬件问题', data: this.hardwareList });
			this.questionDataSortList.push({ title: '司机问题', data: this.driverQuestionList });
			this.questionDataSortList.push({ title: '对接问题', data: this.concatQuestionList });
			this.questionDataSortList.push({ title: '运维问题', data: this.operatQuestionList });
			this.questionDataSortList.push({ title: '安装问题', data: this.installQuestionList });

			modal.show()
		})
	}
	//问题占比饼状图
	loadPieChart() {
		var questionPie = echarts.init(document.getElementById('questionPieChart'));
		questionPie.clear();
		var that = this;
		var scale = 1;
		let temArr = [];
		for (let item of this.dataAbnormalCarList) {
			if (item.value) {
				temArr.push(item);
			}
		}
		var echartData = temArr;
		if (echartData.length == 0) {
			return;
		}
		var rich = {
			yellow: {
				color: "#49dff0",
				fontSize: 18 * scale,
				padding: [5, 4],
				align: 'center'
			},
			total: {
				color: "#49dff0",
				fontSize: 28 * scale,
				align: 'center'
			},
			white: {
				color: "#fff",
				align: 'center',
				fontSize: 14 * scale,
				padding: [5, 4]
			},
			blue: {
				color: '#ffc72b',
				fontSize: 18 * scale,
				padding: [5, 4],
				align: 'center'
			},
			hr: {
				borderColor: '#0b5263',
				width: '100%',
				borderWidth: 1,
				height: 0,
			}
		}
		var option = {
			backgroundColor: '#031f2d',
			title: {
				text: '问题总数',
				left: 'center',
				top: '53%',
				padding: [24, 0],
				textStyle: {
					color: '#fff',
					fontSize: 18 * scale,
					align: 'center'
				}
			},
			legend: {
				selectedMode: false,
				formatter: '{total|' + that.dataAbnormalCarTotal + '}',
				data: [echartData[0].name],
				left: 'center',
				top: 'center',
				icon: 'none',
				align: 'center',
				textStyle: {
					color: "#fff",
					fontSize: 16 * scale,
					rich: rich
				},
			},
			series: [{
				name: '问题总数',
				type: 'pie',
				radius: ['42%', '50%'],
				hoverAnimation: false,
				color: ['#c23531', '#2f4554', '#61a0a8', '#d48265', '#91c7ae', '#749f83', '#ca8622', '#bda29a', '#6e7074', '#546570', '#c4ccd3'],
				label: {
					normal: {
						formatter: function (params, ticket, callback) {
							return '{white|' + params.name + '}{yellow|' + params.value + '}\n{hr|}\n{blue|' + ((+params.value / that.dataAbnormalCarTotal) * 100).toFixed(1) + '%}';
						},
						rich: rich
					},
				},
				labelLine: {
					normal: {
						length: 35 * scale,
						length2: 0,
						lineStyle: {
							color: '#0b5263'
						}
					}
				},
				data: echartData
			}]
		};

		var questionPie = echarts.init(document.getElementById('questionPieChart'));
		questionPie.setOption(option);
		window.onresize = function () {
			if (questionPie) {
				questionPie.resize();
			}
		}
	}
	// 接收子组件传递过来的数据 
	getSelectTableTime(time) {
		this.startTime = time.startTime;
		this.endTime = time.endTime;
	}
	getSelectChartTime(time) {
		this.startTime_chart = time.startTime;
		this.endTime_chart = time.endTime;
	}
	//公司选中回调
	companySelected(data) {
		this.selectedCompanyId = data.companyId;
		this.selectedCompanyName = data.companyName;
		this.deviceId = data.deviceId;
		this.carNumber = data.carNumber;
	}
	runParent(value) {
		this.drawTrackArr = value;
	}
	showMapView(val) {
		this.isMapView = val;
	}
	checkAbnormal(row) {
		if (row.isCheck || row.isCheck == '0') {
			this.quickAudit = true;
		} else {
			this.quickAudit = false;
		}
		this.activeSelected = row.id;
		this.startTime_chart = row.startDate;
		this.endTime_chart = row.endDate;
		this.isChartView = true;
		row.startTime = this.startTime_chart;
		row.endTime = this.endTime_chart;
		this.specifyTime = {
			startTime: this.startTime_chart,
			endTime: this.endTime_chart,
		}
		this.selectedRow = row;

	}
	drawAbnormalChart() {
		if (!this.selectedRow) {
			this.jsonApiService.message('先选择需要查看折线图的车辆');
			return;
		}
		if (!this.startTime_chart || !this.endTime_chart) {
			this.jsonApiService.message('异常起始时间不能为空');
			return;
		}
		let timeCheck = common.correctTimeParams(this.startTime_chart, this.endTime_chart, 0);
		if (!timeCheck.status) {
			this.jsonApiService.message(timeCheck.message);
			return;
		}
		let params = {
			deviceId: this.selectedRow.deviceId,
			startTime: this.startTime_chart,
			endTime: this.endTime_chart,
			coefficient: this.selectedRow.coefficient,
		}
		this.selectedRow = params;

	}
	ngOnInit() {
		var qxdata = JSON.parse(decodeURIComponent(localStorage.getItem('cargpsw_abnormalAler:artificialMonitor')));
		if (qxdata) {
			for (let item of qxdata) {
				if (item.sourceKey === "artificialMonitor:check" && item.parentId) {
					this.checkQuanxian = true;
					break;
				}
			}
		}
		this.initSeletctList();
		if (common.getCookie('jumpQuestionByHandList')) {
			this.searchKey = this.inputCompanyTreeCarData.deviceId;
			this.exceptionType = this.inputCompanyTreeCarData.exceptionType + '';
			this.exceptionTypeChange();
			this.programType = this.inputCompanyTreeCarData.programType + '';
			this.startTime = this.InputTime.startTime = this.inputCompanyTreeCarData.startTime;
			this.endTime = this.InputTime.endTime = this.inputCompanyTreeCarData.endTime;
			this.load();
			common.clearCookie('jumpQuestionByHandList');
		} else {
			let dateRange = common.getRecentDaysDateTime(7);
			this.startTime = this.InputTime.startTime = dateRange.startTime;
			this.endTime = this.InputTime.endTime = dateRange.endTime;
			this.load();
		}
	}
	//明细报表
	exprotData() {
		var parameters = {
			companyId: this.selectedCompanyId,
			deviceId: this.deviceId,
			carNumber: this.carNumber,
			startTime: this.startTime,
			endTime: this.endTime,
			searchKey: this.searchKey,
			useTypeL1: this.useTypeL1,
			useTypeL2: this.useTypeL2,
			exceptionType: this.exceptionType,
			programType: this.programType
		};
		let timeCheck = common.correctTime(parameters);
		if (!timeCheck.status) {
			this.jsonApiService.message(timeCheck.message);
			return;
		}
		common.exprotDataFile(parameters, 'param', config.BaseURL + 'dataExceptionRecord/exportDataRecordFile.html')
	}
	//关闭问题汇总统计图弹窗
	problemTotalClose(modal) {
		modal.hide();
	}
	//问题汇总统计图
	problemTotalTable(modal) {
		modal.show();
		this.exceptionTypeName = this.getExceptionTypeName(this.exceptionType);
		this.programTypeName = this.getProgramTypeName(this.programType);
		this.useTypeL1Name = this.getUseTypeNameL1(this.useTypeL1);
		this.useTypeL2Name = this.getUseTypeNameL2(this.useTypeL2);
		let data = {
			companyId: this.selectedCompanyId,
			carNumber: this.carNumber,
			deviceId: this.deviceId,
			startDate: this.startTime,
			endDate: this.endTime,
			searchKey: this.searchKey,
			useTypeL1: this.useTypeL1,
			useTypeL2: this.useTypeL2,
			exceptionType: this.exceptionType,
			programType: this.programType
		}
		let reqdata = 'param=' + JSON.stringify(data);
		this.jsonApiService.http("dataExceptionRecord/countDataRecord2.html", reqdata).subscribe(result => {
			this.dataAbnormalCarList = [];
			this.dataAbnormalCarTotalList = [];
			this.dataAbnormalCarTotal = 0;
			if (result.data && result.success) {
				let temArr: any = result.data;
				if (temArr.length > 0) {
					for (let item of temArr) {
						let obj = {
							value: item.reasonCount,
							name: item.reason
						}
						this.dataAbnormalCarList.push(obj);
						this.dataAbnormalCarTotalList.push(obj);
						this.dataAbnormalCarTotal += item.reasonCount;
					}
					this.dataAbnormalCarTotalList.push({
						value: this.dataAbnormalCarTotal,
						name: '合计'
					})
				}
				this.loadPieChart();
			}
		})
	}
	topDateSelect(type) {
		this.curBtn = type;
		let curTime = new Date();
		let curDate = common.getTimeDay(curTime);
		let currentMonthDays = new Date().getDate() - 1;
		switch (type) {
			case '1':
				this.startTime = curDate + ' 00:00:00';
				this.endTime = curDate + ' 23:59:59';
				break;
			case '2':
				this.startTime = common.getTimeDay(new Date(curTime.getTime() - 3600 * 24 * 1000 * 6)) + ' 00:00:00';
				this.endTime = curDate + ' 23:59:59';
				break;
			case '3':
				this.startTime = common.getTimeDay(new Date(curTime.getTime() - 3600 * 24 * 1000 * currentMonthDays)) + ' 00:00:00';
				this.endTime = curDate + ' 23:59:59';
				break;
			default:
				this.startTime = '';
				this.endTime = '';
				break;
		}
		$('#datetimepicker1').val(this.startTime).change();
		$('#datetimepicker2').val(this.endTime).change();
		this.initCarDataAbnormalTOP();
	}
	//关闭数据问题车辆TOP20弹窗
	dataAbnormalClose(modal) {
		modal.hide();
	}
	//数据问题车辆TOP20
	carDataAbnormalTop(modal) {
		modal.show();
		this.curBtn = '';
		this.topNumber = '10';
		this.exceptionTypeName = this.getExceptionTypeName(this.exceptionType);
		this.programTypeName = this.getProgramTypeName(this.programType);
		this.useTypeL1Name = this.getUseTypeNameL1(this.useTypeL1);
		this.useTypeL2Name = this.getUseTypeNameL2(this.useTypeL2);
		this.initCarDataAbnormalTOP();
	}
	topNumberChange() {
		this.initCarDataAbnormalTOP();
	}
	initCarDataAbnormalTOP() {
		let data = {
			companyId: this.selectedCompanyId,
			carNumber: this.carNumber,
			deviceId: this.deviceId,
			startDate: this.startTime,
			endDate: this.endTime,
			searchKey: this.searchKey,
			useTypeL1: this.useTypeL1,
			useTypeL2: this.useTypeL2,
			exceptionType: this.exceptionType,
			programType: this.programType
		}
		let reqdata = 'param=' + JSON.stringify(data) + "&topNumber=" + this.topNumber;
		this.jsonApiService.http("dataExceptionRecord/countDataRecordForTop.html", reqdata).subscribe(result => {
			if (result.data && result.success) {
				let temArr: any = result.data;
				this.dataAbnormalCarTopList = temArr;
			}
		})
	}
	//跳转到数据下载页面
	jumpDataload(row) {
		window.open(row.zipPath);
	}

	deleteRow(row) {
		this.jsonApiService.confirm_message("此操作将永久删除数据,确认要删除?").then(() => {
			let reqdata = 'id=' + row.id;
			this.jsonApiService.http("dataExceptionRecord/deleteMonitorRecordById.html", reqdata).subscribe(data => {
				this.jsonApiService.message(data.message);
				this.load();
			})
		})
	}
	exceptionTypeChange() {
		this.questionTypeDetailList = [];
		this.programType = '';
		for (let item of this.questionTypeList) {
			if (item.id === this.exceptionType) {
				this.questionTypeDetailList = item.children;
				break;
			}
		}
	}
	//车辆用途change回调
	carUseTypeL1Change() {
		this.carTypeDetailList = [];
		this.useTypeL2 = '';
		for (let item of this.carTypeList) {
			if (item.id === this.useTypeL1) {
				this.carTypeDetailList = item.children;
				break;
			}
		}
	}

	setCheckrowMes(row) {
		this.checkrowMes = row;
	}
	//审核
	checkRow(checkType, modal) {
		if (!this.checkrowMes) return;
		//		this.jsonApiService.confirm_message("确定该信息无误并审核通过吗?").then(()=>{
		let params = {
			id: this.checkrowMes.id,
			//				isCheck:checkType,
			remark: this.checkRemark,
		}
		let reqdata = '';
		for (let keys in params) {
			reqdata = reqdata + keys + '=' + params[keys] + '&';
		}
		reqdata = reqdata.substring(0, reqdata.length - 1);
		this.jsonApiService.http("dataExceptionRecord/checkfixdatabyid.html", reqdata).subscribe(data => {
			this.jsonApiService.message(data.message);
			this.checkRemark = '';
			this.checkrowMes = {};
			modal.hide();
			this.load();
		})
		//		})
	}
	//模板里面的快速审核
	modalCheckEvent() {
		if (!this.selectedRow) return;
		this.jsonApiService.confirm_message("确定该信息无误并审核通过吗?").then(() => {
			let params = {
				deviceId: this.selectedRow.deviceId,
				startTime: this.selectedRow.startTime,
				endTime: this.selectedRow.endTime,
			}
			let reqdata = '';
			for (let keys in params) {
				reqdata = reqdata + keys + '=' + params[keys] + '&';
			}
			reqdata = reqdata.substring(0, reqdata.length - 1);
			this.jsonApiService.http("dataExceptionRecord/checkfixdata.html", reqdata).subscribe(data => {
				this.jsonApiService.message(data.message);
				this.load();
			})
		})
	}
	//  初始化加载list数据
	load() {
		let timeCheck = common.correctTimeParams(this.startTime, this.endTime, 0);
		if (!timeCheck.status) {
			this.jsonApiService.message(timeCheck.message);
			return;
		}
		let data = {
			pageSize: this.pageSize,
			nowPage: this.curPage,
			parameters: {
				companyId: this.selectedCompanyId,
				carNumber: this.carNumber,
				deviceId: this.deviceId,
				startDate: this.startTime,
				endDate: this.endTime,
				searchKey: this.searchKey,
				useTypeL1: this.useTypeL1,
				useTypeL2: this.useTypeL2,
				isCheck: this.isCheck,
				exceptionType: this.exceptionType,
				programType: this.programType
			}
		}
		let reqdata = 'gridPager=' + JSON.stringify(data);
		this.jsonApiService.http("dataExceptionRecord/dataRecordPage.html", reqdata).subscribe(result => {
			if (!result.isSuccess) {
				this.jsonApiService.message(result.message);
				return;
			}
			for (let item of result.exhibitDatas) {
				item.useTypeL1 = this.getUseTypeNameL1(item.useTypeL1);
				item.useTypeL2 = this.getUseTypeNameL2(item.useTypeL2);
				item.exceptionType = this.getExceptionTypeName(item.exceptionType);
				item.programType = this.getProgramTypeName(item.programType);
				if (item.coefficient) {
					let coefArr = [];
					for (let i = 0; i < item.coefficient.length; i++) {
						let _item = item.coefficient[i];
						if (_item && _item != '0') {
							var obj = {
								value: item.coefficient[i],
								index: i + 1
							}
							coefArr.push(obj);
						}
					}
					item.coef = coefArr;
				} else {
					item.coef = [];
				}
			}
			this.tableData = result.exhibitDatas;
			this.totalCount = result.recordCount;
		})
	}
	//问题分类
	getExceptionTypeName(key) {
		if (key) {
			return this.questionNameList[key];
		} else {
			return '';
		}
	}
	//现象分类
	getProgramTypeName(key) {
		if (key) {
			return this.questionDeatailNameList[key];
		} else {
			return '';
		}
	}
	//key值映射
	getUseTypeNameL1(key) {
		if (key) {
			return this.carUseList[key];
		} else {
			return '';
		}
	}
	//key值映射
	getUseTypeNameL2(key) {
		if (key) {
			return this.carDeatailUseList[key];
		} else {
			return '';
		}
	}
	ngOnDestroy() {
		document.onclick = null;
	}
	//刷新
	refresh() {
		this.load();
	}
	//查询
	table_search() {
		this.curPage = 1;
		this.searchKey = common.stringTrim(this.searchKey);
		this.load();
	}

	//删除所选时间
	//分页回调
	paginate(e) {
		this.curPage = e.page + 1;
		this.pageSize = e.rows;
		this.load();
	}
	closeChart() {
		this.isChartView = false;
	}
	//初始化车辆用途,车辆分类选项数据
	initSeletctList() {
		this.carTypeList = carTypeListObj.carTypeList
		this.carUseList = carTypeListObj.carUseList
		this.carDeatailUseList = carTypeListObj.carDeatailUseList
	}
}
